<template>
    <div>
       <div id="slider" class="mui-slider ">
				<div id="sliderSegmentedControl" class="mui-scroll-wrapper mui-slider-indicator mui-segmented-control mui-segmented-control-inverted">
					<div class="mui-scroll">
						<a :class="['mui-control-item',imels.id==0?'mui-active':'']" v-for="imels in details" :key="imels.id" @click="geiyilein(imels.id)">
							{{imels.title}}
						</a>
						
					</div>
                    </div>
                    </div>
        <ul class="photo-list">
       <router-link :to="'/one/PictueLing/'+item.id " v-for="item in list" :key="item.id" tag="li" >
        <img v-lazy="item.img_url">
		<div class="info">
         <h4 class="info-title">{{item.title}}</h4>
		 <p class="info-body">{{item.zhaiyao}}</p>
		</div>
     </router-link>
     </ul>



    </div>
</template>
<script>
 import mui from "../../lib/mui/js/mui.min.js";


export default {
     data() {
        return {
		details:[],
		list:[]
     }
	},
	//mounted安装
	mounted(){
		mui('.mui-scroll-wrapper').scroll({
	deceleration: 0.0005 //flick 减速系数，系数越大，滚动速度越慢，滚动距离越小，默认值0.0006
     });
   },
   created(){
	   this.getdetails();
	   this.geiyilein(0);
   },

	 methods: {
		getdetails(){
			this.$http.get("api/getimgcategory").then(result=>{
           // console.log(result);
			if(result.body.status ===0){
		    result.body.message.unshift({title:"全部",id:0});
		   this.details=result.body.message
		   //console.log(this.details);
			}
			})
		},
		geiyilein(catesId){
			this.$http.get("api/getimages/"+catesId).then(result => {
				  //console.log(result);
				 if(result.body.status===0){
               this.list=result.body.message
				 } 
			})
		
		}
		
	},
}
</script>
<style lang="scss" scoped>
*{
	//很有用通配符调整[Intervention] Unable to preventDefault inside passive event listener due to target being treated as passive. See
	touch-action: pan-y;
	margin: 0;
    padding: 0;

}

.photo-list{
	li{
		width: 96%;
		margin: 0 auto;
		list-style-type: none;
		text-align: center;
		margin-bottom: 5px;
		position: relative;
		img{
			width:100%;
			height:200px;
		}
		 img[lazy=loading] {
      width: 40px;
      height: 300px;
      margin: auto;
}
  .info{
		color: #ffffff;
		background: rgba($color: black, $alpha:0.4);
		position: absolute;
		padding: 10px;
		text-align: left;
        box-sizing: bottom-box;
		bottom: 0;
		height: 80px;
		
		.info-title{
       font-size: 20px
		}
		.info-body{
    font-size: 8px;
	width: 100%;
	display: -webkit-box;
	   overflow: hidden; 
        -webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
		line-height: 12px
		}
	}
	}
	
}
</style>
